package com.lxc.crud.mapper;

import com.lxc.crud.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface UserMapper {
    @Insert("insert into user(name,age,email,address) values(#{name},#{age},#{email},#{address})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    public void insert(User user);

    @Select("select id,name,age,email,address from user where id in (${ids})")
    @ResultType(User.class)
    public ArrayList<User> selectByIds(String ids);

    @SelectProvider(type=UserMapperSql.class,method="selectByMultiCondition")
    @ResultType(User.class)
    public ArrayList<User> selectByMultiCondition(User user);

    @UpdateProvider(type=UserMapperSql.class,method="updateById")
    public int updateById(User user);

    @Delete("delete from user where id=#{id}")
    public int deleteById(int id);
}
